var mysql = require('mysql');
var connection = mysql.createConnection({
    host :'localhost',
    user :'root',
    password :'123456',
    database : 't2'
});
connection.connect();
var additem = 'INSERT INTO websites(Id,name,url,alexa,country) VALUES(0,?,?,?,?),(0,?,?,?,?)';
var addSqlParams = ['烤红薯','https://c.runoob.com','23453','CN','卖大米','https://www.beybey.com','23453','CK'];

var updataItem = 'UPDATE websites SET name = ?,url = ? WHERE Id = ?';
var updataParams = ['菜鸟之家','ttt.yyyy.com',6];
// operation(updataItem,updataParams);


// function operation(sql,params){
//     console.log(sql);
//     connection.query(sql,params,function(error,results){
//         if(error){
//             console.log('error',results);
//             return;
//         }
//         console.log("successfuly",results);
//     });
// }

connection.query(additem,addSqlParams,function(error,results){
    if(error){
       return; 
    }
    console.log(results);
});
// connection.query('SELECT * from  websites where id=2', function(error,results,filters){
//     if(error){
        
//     }
//     console.log("目标未知",results);
// })
console.log("汽车人出发!");